<html><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8"><title>UserGuide - Constants</title></head>
<body bgcolor="#FFFFDF" link="#009999" vlink="#006666" alink="#006666">
<font face="Arial" size="2"><p align="center"><b><font size="5">UserGuide - Constants</font></b></p>



In addition to <a href="../reference/variables.html">variables</a> PureBasic provides a method to 
define <a href="../reference/general_rules.html">constants</a> too. In fact it provides several. 
We抣l have a quick look at them now. 

Predefined constants - provided either by PureBasic itself, these all begin #PB_, or 
from the API for the operating system. The IDE抯 <a href="../reference/ide_tools.html">Structure Viewer</a> 
tool has a panel which shows all the predefined constants. 

User defined constants - by defining a constant name with the prefix # you can provide 
your own constants to make code more readable. 
 
<pre><font face="Courier New, Courier, mono"size="2">  <font color="#924B72">#MyConstant1</font> = 10
  <font color="#924B72">#MyConstant2</font> = "Hello, World!"
</font></pre>

<a href="../reference/enumerations.html">Enumerations</a> �PureBasic will automatically number a 
series of constants sequentially in an Enumeration, by default enumerations will 
begin from zero �but this can be altered, if desired. 

 

<pre><font face="Courier New, Courier, mono"size="2">  <b><font color="#006666">Enumeration</font></b>
  �<font color="#924B72">#MyConstantA</font>
  �<font color="#924B72">#MyConstantB</font>
  �<font color="#924B72">#MyConstantC</font>
  <b><font color="#006666">EndEnumeration</font></b>
  
  <b><font color="#006666">Enumeration</font></b> 10 <b><font color="#006666">Step</font></b> 5
  �<font color="#924B72">#MyConstantD</font> <font color="#006666">; will be 10</font>
  �<font color="#924B72">#MyConstantE</font> <font color="#006666">; will be 15</font>
  �<font color="#924B72">#MyConstantF</font> <font color="#006666">; will be 20</font>
  <b><font color="#006666">EndEnumeration</font></b>
</font></pre>


<p><b>UserGuide Navigation</b></p><blockquote>

<a href="../reference/ug_variables.html">&lt; Previous: Variables</a> | <a href="../reference/ug_overview.html">Overview</a> | <a href="../reference/ug_decisions.html">Next: Decisions &amp; Conditions &gt;</a> 
</body></html>